package com.inspur.humantask.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class FormTableJsonController {
	
	private Logger logger= LoggerFactory .getLogger(FormTableJsonController.class);
	
	@Autowired
	JdbcTemplate jdbcTemplate;
	
	@RequestMapping("/processlog/{id}")
	@CrossOrigin
	public Object getTableDate(@PathVariable("id") String id) {
		String sql="select * from scidc.process_log where processId="+id;
		HashMap<String,Object> mTableConifg=new HashMap();
		List<Map<String, Object>> mtableData=jdbcTemplate.queryForList(sql);
		mTableConifg.put("tableTable", mtableData.get(0));
		String sqltitle="select tabletitle from scidc.t_dic_flow_log  where id="+	mtableData.get(0).get("configId");
		mTableConifg.put("titleKey", jdbcTemplate.queryForList(sqltitle).get(0));
		return mTableConifg;
	}
	
	
}
